package zjz.graduation.backend.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import zjz.graduation.backend.mapper.CasesDao;
import zjz.graduation.backend.model.Cases;

import java.util.List;

@Service
public class CasesServiceImpl implements CasesService{
    @Autowired
    CasesDao casesDao;

    @Override
    public List<Cases> getAllCases() {
        return casesDao.selectAll();
    }

    @Override
    public boolean createCase(Cases record) {
        return casesDao.insert(record)>0;
    }

    @Override
    public Cases getCase(int cid) {
        return casesDao.selectByPrimaryKey(cid);
    }

    @Override
    public void updateStatus(Integer cid, int i) {
        casesDao.updateStatusByPrimaryKey(cid,i);
    }

    @Override
    public List<Cases> getUnreviewedCases() {
        return casesDao.selectUnreviewd();
    }


}
